<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>class与await结合</title>
  </head>
  <body></body>
  <script src="js/ajax.js"></script>
  <script>
    class User {
      constructor(name) {
        this.name = name;
      }
      then(resolve, reject) {
        let user = ajax(`http://localhost:80/php/user.php?name=${this.name}`);
        resolve(user);
      }
    }
    async function get() {
      let user = await new User("后盾人");
      console.log(user);
    }
    get();
  </script>
</html>
